<%--
  - Author		:	이 영호(Youngho Lee)	
  --%>
<%@ page language="java" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/pages/includes/taglibs.jspf" %>
<%@ include file="/WEB-INF/pages/includes/variables.jspf" %>
<%@ include file="/WEB-INF/pages/includes/doctype.jspf" %>
<c:choose>
	<c:when test="${param.boardType eq 'notice'}">
		<c:set var="type" value="1" />
		<c:set var="boardTitle" value="공지사항" />
		<c:set var="boardImg" value="subtit_04_1.gif" />
		<c:set var="boardListUrl" value="notice.do" /> 
	</c:when>
	<c:when test="${param.boardType eq 'qna'}">
		<c:set var="type" value="2" />
		<c:set var="boardTitle" value="문의하기" />
		<c:set var="boardImg" value="subtit_04_2.gif" />
		<c:set var="boardListUrl" value="qna.do" /> 
	</c:when>
	<c:when test="${param.boardType eq 'file'}">
		<c:set var="type" value="3" />
		<c:set var="boardTitle" value="자료실" />
		<c:set var="boardImg" value="subtit_04_3.gif" />
		<c:set var="boardListUrl" value="file.do" /> 
	</c:when>
</c:choose>
<html>
	<head>
<%@ include file="/WEB-INF/pages/includes/metatags.jspf" %>
		<title><fmt:message key="pages.title" /></title>
		<link rel="stylesheet" type="text/css" href="<c:url value="${dirStyles}/common.css" />" />

		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript" src="<c:url value="${dirScripts}/jquery-ui-1.8.21.custom.min.js" />"></script>
		<script type="text/javascript" src="<c:url value="${dirScripts}/utils.js" />"></script>
		<script type="text/javascript">
			$(function(){
			});
			
			function goAction(type){
				if(type == "modify"){
					document.modifyFrm.fAct.value='modify';
					document.modifyFrm.action="<c:url value="/board/form.do" />";
					document.modifyFrm.submit();
				}else if(type == "remove" && confirm("삭제하시겠습니까?")){
					document.modifyFrm.fAct.value='remove';
					document.modifyFrm.action="<c:url value="/board/submit.do" />";
					document.modifyFrm.submit();
				}
			}

		</script>
	</head>
	<body>
<%@ include file="/WEB-INF/pages/includes/header.jsp" %>
		<div class="bodyWrap">
<%@ include file="/WEB-INF/pages/includes/left.jsp" %>
			<div class="contWrap">
				<div class="contMenuTitle">
					<img src="<c:url value="${dirImages}/${boardImg}" />" title="${boardTitle}" alt="${boardTitle}">
				</div>
				<div class="secTitle">
					<img src="<c:url value="${dirImages}/icon.png" />" title="${boardTitle}" alt="${boardTitle}" > ${boardTitle}
				</div>
				<form name="frm" method="post" enctype="multipart/form-data" action="<c:url value="/board/submit.do" />">
					<input type="hidden" name="maxnum" value="${maxnum}" />
					<input type="hidden" name="page" value="${page}" />
					<input type="hidden" name="searchType" value="${param.searchType}" />
					<input type="hidden" name="searchWord" value="${param.searchWord}" />
					<table class="formTbl">
						<colgroup>
							<col width="100px" />
							<col width="367px" />
							<col width="100px" />
							<col width="*" />
						</colgroup>
						<tbody>
							<tr>
								<th>작성자</th>
								<th>
									${board.createdNm}
								</th>
								<th>작성일</th>
								<th>
									<jsp:useBean id="now" class="java.util.Date" />
									<fmt:formatDate value="${now}" pattern="yyyy/MM/dd" />
								</th>
							</tr>
							<tr>
								<th>제목</th>
								<td colspan="3">
									<c:out value="${board.title}" />
								</td>
							</tr>
							<tr>
								<th>내용</th>
								<td colspan="3">
									<textarea name="cont" style="width: 615px; height: 320px;margin: 5px 0; border: none;">${board.cont}</textarea>
								</td>
							</tr>
							<c:if test="${param.boardType eq 'file' or param.boardType eq 'testerResult'}">
								<tr>
									<th>첨부파일</th>
									<td colspan="3">
										<c:if test="${not empty board.file}">
											<a href="${board.file}" target="blank">첨부파일 다운</a>
										</c:if>
									</td>
								</tr>
							</c:if>
						</tbody>
					</table>
				</form>
				<div class="btnWrap centerBtnWrap">
					<input type="button" class="btn btn_list" alt="목록" title="목록" onclick="javascript:document.listFrm.submit();">
					<c:if test="${board.createdId eq sessionScope.userId}">
						<input type="button" class="btn btn_delete" style="float:right; margin-left: 10px;" alt="삭제" title="삭제" onclick="javascript:goAction('remove');">
						<input type="button" class="btn btn_revision" style="float:right;" alt="수정" title="수정" onclick="javascript:goAction('modify');">
					</c:if>
				</div>
			</div>
		</div>
		<form name="listFrm" method="post" action="<c:url value="/board/${param.boardType}.do" />">
			<input type="hidden" name="maxnum" value="${param.maxnum}" />
			<input type="hidden" name="page" value="${param.page}" />
			<input type="hidden" name="searchType" value="${param.searchType}" />
			<input type="hidden" name="searchWord" value="${param.searchWord}" />
		</form>
		<form name="modifyFrm" method="post" action="">
			<input type="hidden" name="fAct" value="" />
			<input type="hidden" name="idx" value="${board.idx}" />
			<input type="hidden" name="maxnum" value="${param.maxnum}" />
			<input type="hidden" name="page" value="${param.page}" />
			<input type="hidden" name="boardType" value="${param.boardType}" />
			<input type="hidden" name="type" value="${type}" />
			<input type="hidden" name="searchType" value="${param.searchType}" />
			<input type="hidden" name="searchWord" value="${param.searchWord}" />
		</form>
<%@ include file="/WEB-INF/pages/includes/footer.jsp" %>
	</body>
</html> 